package com.hengpeng.itfin.tools;

import java.text.DecimalFormat;

import com.hengpeng.itfin.constants.MSConstants;

/**
 * <pre>
 * 流水号生成器
 * </pre>
 * @author zhaojitao
 * @version 1.0, 2010-11-29
 */
public class SequenceGenerator
{

	public static String createSequenceNo(String prefix, String suffix, Integer length, long seq)
	{
		prefix = null == prefix ? "" : prefix;
		suffix = null == suffix ? "" : suffix;
		String sequenceNo = prefix;
		if (null == length || length < 0)
		{
			sequenceNo += String.valueOf(seq);
		}
		else
		{
			sequenceNo += String.format("%0" + length + "d", seq);
		}
		sequenceNo += suffix;
		return sequenceNo;
	}
}
